public class HushBuck {
        static class Node{
            public int key;
            public int value;
            public Node next;
            public Node(int key,int value){
                this.key=key;
                this.value=value;
            }
        }
        public Node[] array;
        public int Usedsize;
        public HushBuck(){
            array=new Node[10];
        }
        public double loadFuctor=0.75;


        public void put(int key,int value){
            int index=key %array.length;
            Node cur=array[index];
            while(cur!=null){
                if(cur.key==key){
                    cur.value=value;
                    return;
                }
                cur=cur.next;
            }
            Node node=new Node(key,value);
            node.next=array[index];
            array[index]=node;
            Usedsize++;
            if(loadFuctorCount()>=0.75){
                //扩容
          resize();
            }
        }
        private void resize(){
        Node[] newArray=new Node[array.length*2];
            for (int i = 0; i < array.length; i++) {
                Node cur=array[i];
                if(cur!=null){
                    Node curN=cur;
                    int newIndex=cur.key% array.length;
                    cur.next=newArray[newIndex];
                    newArray[newIndex]=cur;
                    cur=curN;
                }
            }
            array=newArray;
        }
        private double loadFuctorCount(){
            return Usedsize*1.0/ array.length;
        }


        public int get(int key){
            int Index=key% array.length;
            Node cur=array[Index];
            while (cur!=null){
                if(cur.key==key){
                    return cur.value;
                }
                cur=cur.next;
            }
            return  -1;
        }


}
